<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red {
            background-color: red;
            width: 500px;
            height: 500px;
            border-radius:50% ;
        }
        .yellow {
            background-color: yellow ;
            width: 500px;
            height: 500px;
            border-radius:50% ;
        }

        .green {
            background-color: green;
            width: 500px;
            height: 500px;
            border-radius:50% ;
        }


    </style>
</head>
<body>
  
    <div>
        <div id="app">
            <button v-on:click='click1'>点击改变颜色</button>
            <p v-bind:class="classArr[index]"></p>
            <!-- <p :class="classArr[index]"></p> -->
        </div>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

    <script>
     
        var vm = new Vue({
            el:'#app',
            data:{
               classArr:['red','yellow','green'],
               index:0,
               count:0
            },
            // 还可以传入methods 方法的集合 
            methods:{
               
                click1(){
                    console.log('click1')
                   
                   
                }
            }
        })
    </script>
</body>
</html>